<%
Function CatOption(checked_id,mode)
	Dim arrs ,sqls,arrmess,ai,arrx,arry
	select case mode
		case 0:'栏目
			sqls="select [cat_id],[cat_name] from "&ConstDBtablearr(0)&" order by [cat_level] asc"
			arrs = GetRows(sqls)
		case 1:'rank
			arrx= 2
			arry=10
			redim arrs(arrx,arry)
			for ai =0 to arry
				arrs(0,ai)=  ai
				arrs(1,ai)= ai
			next
		case 3:'栏目
			sqls="select [cat_id],[cat_name] from "&ConstDBtablearr(0)&" where [cat_parent]=0 order by [cat_level] asc"
			arrs = GetRows(sqls)
		case 2:
			arrs = WeatherArr()
		case else:exit Function 
	End Select
	Dim findSelected
	findSelected=False 
	if isarray(arrs) then  
		If( mode=3) Then
			Dim LastU
			LastU=ubound(arrs,2)
 			redim preserve arrs(1, LastU+1)
			Dim arrTemp
			arrs(0,LastU+1)="0"
			arrs(1,LastU+1)="------"
		End If 
		for ai=0 to ubound(arrs,2)
			if checked_id= arrs(0,ai) Or (findSelected=False And mode=3 And ai=ubound(arrs,2)) then 
				findSelected = True 
				arrmess = arrmess &"<option value='"&arrs(0,ai)&"' selected style='background:#E1E1E1;color:#000000;font-weight:bold;padding:2px'>"&arrs(1,ai)&"</option>"
			else
				arrmess = arrmess &"<option value='"&arrs(0,ai)&"'>"&arrs(1,ai)&"</option>"
			End if
		next
	End If
 	'erase arrs
	CatOption = arrmess
End Function 
'获取栏目块
Function OutCatalogeBar(ByVal keyName,ByVal keyType)
	Dim outMessage,pid,tempid
	outMessage="<div id = ""boot_sort"">"
	


	pid=keyName
	tempid=killint(getone("select top 1 [cat_parent] from "&ConstDBtablearr(0)&" where [cat_id]=" & pid),0,0,5)
	If(tempid>0) Then pid = tempid
		
	Dim sqls,arrs,ai,catmess,lockyes
	'不显示加密的
	lockyes = True 
	sqls="select [cat_id],[cat_name],[cat_parent],[cat_other] from "&ConstDBtablearr(0)&" where [cat_parent]=0 order by [cat_level] desc"
	arrs = GetRows(sqls)
	catmess = "<ul>"
	if isarray(arrs) then  
		Dim lastCount
		lastCount=UBound(arrs,2)+1
		ReDim preserve arrs(3,lastCount)
		arrs(0,lastCount)="0"
		arrs(1,lastCount)="首页"
		arrs(2,lastCount)="0"
		arrs(3,lastCount)="0"
		for ai=ubound(arrs,2) to 0 step -1
			Dim SelectCssStyle
			SelectCssStyle=""
			If(killint(arrs(0,ai),0,0,5)=killint(pid,0,0,5)) Then
				SelectCssStyle =" class=""selected"""
			End If 
			if killint(arrs(3,ai),0,0,10) > 0  then 
				if lockyes = false   then
					catmess = catmess &"<li"& SelectCssStyle &"><a href="""&  IIF(NeedHtmlPage, GetCatlogueURLPath(arrs(0,ai)),BaseURI & "catalogue.asp?id=" & arrs(0,ai))&"""      style=""font-weight:700;color:#FFFFAA;"">"&arrs(1,ai)&"</a></li>"
				else
					if GetUserLevelInt() >= killint(arrs(3,ai),0,0,10) then 
						catmess = catmess &"<li"& SelectCssStyle &"><a href="""&    BaseURI & "sort.asp?id="&arrs(0,ai)&"""      style=""font-weight:700;color:#00F700;"">"&arrs(1,ai)&"</a></li>"
					else
						'catmess = catmess &"<li><a>"&arrs(1,ai)&"</a></li>"
					End if
				End if 
			else 
				catmess = catmess &"<li"& SelectCssStyle &"><a href="""&   IIF(NeedHtmlPage,GetCatlogueURLPath(arrs(0,ai)), IIF(killint(arrs(0,ai),0,0,3)=0,BaseURI,BaseURI & "catalogue.asp?id=" & arrs(0,ai))) &""">"&arrs(1,ai)&"</a></li>"
			End if 
		next
	End if
			catmess = catmess &"</ul>"
	
	
	outMessage = outMessage & catmess
	outMessage = outMessage & "</div>"
	outMessage = outMessage & "<div class=""ChildSort"">"
	catmess = "<p>"
	If(pid=0) Then 
		catmess = catmess & "<a href=""/admin/"">管理</a>"
	Else 
		sqls="select [cat_id],[cat_name],[cat_parent],[cat_other] from "&ConstDBtablearr(0)&" where [cat_parent]="&  killint(pid,0,0,5)&" order by [cat_level] desc"
		arrs = GetRows(sqls)
		if isarray(arrs) then 
			For ai=0 To UBound(arrs,2)  
				SelectCssStyle=""
				If(killint(arrs(0,ai),0,0,5)=killint(keyName,0,0,5)) Then
					SelectCssStyle =" class=""selected"""
				End If 
				catmess = catmess &"<a href="""&   IIF(NeedHtmlPage,GetCatlogueURLPath(arrs(0,ai)),BaseURI & "catalogue.asp?id=" & arrs(0,ai)) &""""&SelectCssStyle&">"&arrs(1,ai)&"</a>"
			Next 
		End If 
	End If 
	catmess = catmess & "</p>"
	outMessage = outMessage & catmess
	outMessage = outMessage & "</div>"
	OutCatalogeBar = outMessage
End Function 
'获取栏目路径
Function GetCataloguePath(ByVal cid)

	GetCataloguePath = Replace(GetRePath (cid,GetAppData(1) ) & "/","//","/")
End Function 
Function GetRePath(byval cid,ByRef catArr)
	If(Not IsArray(catArr)) Then Exit Function 
	'If(UBound(catArr,2)<1)	Then Exit Function 
	Dim ai,reId,newEmptyPath
	newEmptyPath = ""
	' [cat_id],[cat_name],[cat_parent],[cat_path]
	For ai=0 To UBound(catArr,2) 
		If(killint(catArr(0,ai),0,0,5) = killint(cid,0,0,5) ) Then
			newEmptyPath =   Trim(catArr(3,ai))  
			reId	=killint(catArr(2,ai),0,0,5)
			If(reId>0) Then 
				cid = reId
				newEmptyPath = GetRePath(reId,catArr) & "/" & newEmptyPath
			End If 
			Exit For 
		End If 
	Next 
	GetRePath = newEmptyPath 
End Function 
'获取栏目的XML节点
Function GetPathXml(ByVal cid)
	GetPathXml = GetRePathNodes(cid,GetAppData(1))
End Function 
Function GetRePathNodes(ByVal cid,ByRef catArr)
	If(Not IsArray(catArr)) Then Exit Function 
	'If(UBound(catArr,2)<1)	Then Exit Function 
	Dim ai,reId,newEmptyPath
	newEmptyPath = ""
	For ai=0 To UBound(catArr,2) 
		If(killint(catArr(0,ai),0,0,5) = killint(cid,0,0,5) ) Then
			newEmptyPath = "<Node><name>"& HTMLEncode( catArr(1,ai) ) &"</name><href>" &   IIF(NeedHtmlPage,GetCatlogueURLPath(Trim(catArr(0,ai))),BaseURI & "catalogue.asp?id=" & cid)   & "</href></Node>"
			reId	=killint(catArr(2,ai),0,0,5)
			If(reId>0) Then 
				cid = reId
				newEmptyPath = GetRePathNodes(reId,catArr) &  newEmptyPath
			End If 
			Exit For 
		End If 
	Next 
	GetRePathNodes = newEmptyPath 
End Function 
'获取栏目的URL记录
Function GetCatlogueURLPath(ByVal cid)

	Dim tpath
	tpath=GetCataloguePath(cid)
	If Not (Left(tpath,7)="http://") Then tpath = BaseURI  & tpath
	GetCatlogueURLPath = RemoveTrim(tpath,"/") & "/"
End Function 

'最新的发表
Function GetTopSubject(ByVal topn,cuttitle,nolock,ByVal catid)
	Dim sqls,arrs,ai,catmess,sqlapp
	sqlapp ="(1=1)"
	If(catid>0) Then sqlapp = "([cat_id]=" & catid & ")"
	if nolock = true then 
	sqls="select top "&killint(topn,0,0,3)&" [info_id],[info_title],[info_time],[cat_id],[info_path] from "&ConstDBtablearr(1)&" where ( [cat_id] not in(select [cat_id] from "&ConstDBtablearr(0)&" where ([cat_other])> "&GetUserLevelInt()&" and "& sqlapp &" ) and "& sqlapp &" ) order by [info_id] desc"
	else
	sqls="select top "&killint(topn,0,0,3)&" [info_id],[info_title],[info_time],[cat_id],[info_path] from "&ConstDBtablearr(1)&"  where "& sqlapp &" order by [info_id] desc"
	End if 
	arrs = GetRows(sqls)
	catmess = "<Nodes>"
	if isarray(arrs) then  
		for ai=0 to ubound(arrs,2)
			catmess = catmess &"<node id="""&arrs(0,ai)&""" time="""&arrs(2,ai)&""" path="""& IIF(NeedHtmlPage, GetCatlogueURLPath(arrs(3,ai))  & arrs(4,ai),BaseURI & "item.asp?id=" & arrs(0,ai))&""">"&CutStr(arrs(1,ai),killint(cuttitle,0,0,5))&"</node>"
		next
	End if
	catmess = catmess &"</Nodes>"
	GetTopSubject = catmess
End Function  
'最新日志提取
function OutTopInfoContents(ByVal topn,cuttitle,lockyes)
	Dim sqls,arrs,ai,catmess
	if lockyes = true then 
		sqls="select top "&killint(topn,0,0,3)&" "&ConstDBtablearr(1)&".[info_id],"&ConstDBtablearr(1)&".[info_hit],"&ConstDBtablearr(1)&".[info_time],"&ConstDBtablearr(1)&".[cat_id],"&ConstDBtablearr(1)&".[info_htmlorubb],"&ConstDBtablearr(1)&".[info_content],"&ConstDBtablearr(1)&".[user_id],"&ConstDBtablearr(1)&".[info_weather],"&ConstDBtablearr(1)&".[info_title],"&ConstDBtablearr(1)&".[info_path]  from "&ConstDBtablearr(0)&","&ConstDBtablearr(1)&" where ( "&ConstDBtablearr(1)&".[cat_id] not in(select "&ConstDBtablearr(0)&".[cat_id] from "&ConstDBtablearr(0)&" where ( [cat_other])> "&GetUserLevelInt()&"  )  and  "&ConstDBtablearr(0)&".[cat_id] = "&ConstDBtablearr(1)&".[cat_id] ) order by "&ConstDBtablearr(1)&".[info_id] desc"
	else
		sqls="select top "&killint(topn,0,0,3)&" [info_id],[info_hit],[info_time],[cat_id],[info_htmlorubb],[info_content],[user_id],[info_weather],[info_title],[info_path] from "&ConstDBtablearr(1)&"   order by [info_id] desc"
	End if 
	arrs = GetRows(sqls)
	catmess = "<Nodes>"
	if isarray(arrs) then  
	Dim weather:weather =WeatherArr()
		for ai=0 to ubound(arrs,2)
			catmess = catmess & "<Node id="""& arrs(0,ai) &""">"
			catmess = catmess & "<path>"& IIF(NeedHtmlPage,GetCatlogueURLPath(arrs(3,ai))   & arrs(9,ai) ,BaseURI & "item.asp?id=" & arrs(0,ai))&"</path>"
			catmess = catmess & "<title><![CDATA["&  arrs(8,ai) &"]]></title>"
			catmess = catmess & "<content><![CDATA["
			if  arrs(4,ai) = False then 
				catmess = catmess & bbcode(CutStr(arrs(5,ai),killint(cuttitle,0,0,5))) 
			else
				catmess = catmess & CutStr(arrs(5,ai),killint(cuttitle,0,0,5)) 
			end if
			catmess = catmess & "]]></content>"
				catmess = catmess &"<info weather="""&weather(1,killint(arrs(7,ai),0,0,5))&" "" username ="""&GetUserByID(arrs(6,ai))&""" userid="""& arrs(6,ai) &""" time="""&arrs(2,ai)&""" hits="""&arrs(1,ai)&""" reply="""&CountReply(arrs(0,ai))&"""/>"
			catmess = catmess & "</Node>"
		next
	End if
			catmess = catmess &"</Nodes>"
	OutTopInfoContents = catmess	
end function 
'计算回复量
Function CountReply(ByVal info_id)
	Dim sqlstr
	sqlstr = "select count(*) from "&ConstDBtablearr(3)&" where [info_id]="&killint(info_id,0,0,10)&""
	CountReply = killint(GetOne(sqlstr),0,0,10)
End Function 
'得出用户名
Function GetUserByID(ByVal user_id)
	Dim sqlstr
	sqlstr = "select top 1 [user_name] from "&ConstDBtablearr(2)&" where [user_id]="&killint(user_id,0,0,10)&""
	GetUserByID = GetOne(sqlstr)
End Function 

'最新的发表
Function GetTopReply(topn,cuttitle,lockyes,ByVal Incatids)
	Dim sqls,arrs,ai,catmess,sqlApp
	sqlApp="(1=1)"
	If (Len(CStr( Incatids ))>0) Then
		sqlApp="(B.[cat_id] in (" & Incatids & "))"
	End If 
	'if lockyes = true then '加密回复内容,md ，这东西消耗了我的很多资源...
	'	sqls="select top "&killint(topn,0,0,3)&" ["&ConstDBtablearr(3)&"].[info_id],["&ConstDBtablearr(3)&"].[user_name],["&ConstDBtablearr(3)&"].[reply_content],["&ConstDBtablearr(3)&"].[reply_time],["&ConstDBtablearr(3)&"].[reply_id] from ["&ConstDBtablearr(3)&"],["&ConstDBtablearr(1)&"] where   "&ConstDBtablearr(1)&".[info_id] = ["&ConstDBtablearr(3)&"].[info_id] and ["&ConstDBtablearr(3)&"].[info_id] not in (select ["&ConstDBtablearr(1)&"].[info_id] from ["&ConstDBtablearr(1)&"],["&ConstDBtablearr(0)&"] where ["&ConstDBtablearr(1)&"].[cat_id]=["&ConstDBtablearr(0)&"].[cat_id] and ["&ConstDBtablearr(0)&"].[cat_other] > "&GetUserLevelInt()&") order by ["&ConstDBtablearr(3)&"].[reply_id] desc"
	'else
		sqls="select top "&killint(topn,0,0,3)&" A.[info_id],[user_name],[reply_content],[reply_time],[reply_id],B.info_path,B.cat_id from ["&ConstDBtablearr(3)&"] A left join [L_info] B ON A.info_id=B.info_id where (1=1) and "& sqlApp &" order by [reply_id] desc"
	'End if 
	arrs = GetRows(sqls)
	catmess = "<Nodes>"
	if isarray(arrs) then  
		for ai=0 to ubound(arrs,2)
			catmess = catmess &"<node user="""&arrs(1,ai)&""" time="""&arrs(3,ai)&""" iid="""&arrs(0,ai)&"""  id="""&arrs(4,ai)&"""  path="""& IIF(NeedHtmlPage,GetCatlogueURLPath(arrs(6,ai)) &arrs(5,ai),BaseURI & "item.asp?id=" & arrs(0,ai) )&"""><![CDATA["&CutStr(ClearHtml(arrs(2,ai)),killint(cuttitle,0,0,5))&"]]></node>"
		next
	End if
			catmess = catmess &"</Nodes>"
	GetTopReply = catmess
End Function  

'取出前几条友情链接

Function OutLinksTopn(ByVal topn)
	Dim sqls,arrs,ai,catmess
	sqls="select top "&killint(topn,0,0,3)&" [link_title],[link_url],[link_logo] from ["&ConstDBtablearr(4)&"]   order by [link_level] asc"
	arrs = GetRows(sqls)
	catmess = "<Nodes>"
	if isarray(arrs) then  
		for ai=0 to ubound(arrs,2)
			catmess = catmess &"<Node><name>"& arrs(0,ai) &"</name><link><![CDATA["& arrs(1,ai) &"]]></link><img>"& HTMLEncode(arrs(2,ai)) &"</img></Node>"
		next
	End if
	catmess = catmess &"</Nodes>"
	OutLinksTopn = catmess
End Function 
'发布回复信息
Function AddReply(arrs)
		Dim objtemp
		Set objtemp = new Reply
		objtemp.PThisMdb	= ConstDBtablearr(3)'栏目的表格
		if objtemp.AddNew(arrs) then 
			AddReply = true 
		else
			AddReply = false 
		End if 
		Set objtemp = nothing 
End Function 
'天气数据
Function WeatherArr()
	Dim arrx,arry,arrs,ai
			arrx= 2
			arry=10
			redim arrs(arrx,arry)
			for ai =0 to arry
				arrs(0,ai)= ai
			next
				arrs(1,0) ="大雨"
				arrs(1,1) ="小雨"
				arrs(1,2) ="阴天"
				arrs(1,3) ="狂风"
				arrs(1,4) ="微风"
				arrs(1,5) ="晴朗"
				arrs(1,6) ="炎热"
				arrs(1,7) ="清凉"
				arrs(1,8) ="寒冷"
				arrs(1,9) ="小雪"
				arrs(1,10) ="大雪"
	WeatherArr = arrs
End Function 
'获取栏目名称
public Function GetCatName(cid)
	Dim catArr:catArr= GetAppData(1)
	Dim catNameTemp ,ai
	If(Not IsArray(catArr)) Then Exit Function 
	For ai=0 To UBound(catArr,2) 
		If(killint(catArr(0,ai),0,0,5) = killint(cid,0,0,5) ) Then
			catNameTemp = Trim(catArr(1,ai))
			Exit For 
		End If 
	Next 
	GetCatName= catNameTemp
End Function 
'栏目缓存数据
Function GetCatalogueCacheData()
	GetCatalogueCacheData =GetRows ("select [cat_id],[cat_name],[cat_parent],[cat_path] from  "&ConstDBtablearr(0))
End Function 
'根据某个栏目ID获取其下属的所有ID，用逗号隔开
'例如传入 A = 43 
'返回B = (43,45,45,65)
Function GetWithChildsInIDs(beginId) 
	Dim newInstr
	newInstr ="("
	newInstr = newInstr & beginId
	newInstr = newInstr & ReGetChildsID(beginId)
	newInstr = newInstr & ")"
	GetWithChildsInIDs = newInstr
End Function 
Function ReGetChildsID(beginId) 
	Dim catArr:catArr= GetAppData(1)
	If(Not IsArray(catArr)) Then Exit Function 
	Dim ai,StrSqls
	StrSqls =""
	For ai=0 To UBound(catArr,2) 
		If(killint(catArr(2,ai),0,0,5) = killint(beginId,0,0,5) ) Then
			StrSqls = StrSqls & "," &  catArr(0,ai) & ReGetChildsID( killint(catArr(0,ai),0,0,5) )
		End If 
	Next 
	ReGetChildsID = StrSqls
End Function 
'获取父栏目的所有ID编号.
Function GetWithParentsInIDs(beginId) 
	Dim newInstr
	newInstr ="("
	newInstr = newInstr & beginId
	newInstr = newInstr & ReGetParentsID(beginId)
	newInstr = newInstr & ")"
	GetWithParentsInIDs = newInstr
End Function 
Function ReGetParentsID(beginId) 
	Dim catArr:catArr= GetAppData(1)
	If(Not IsArray(catArr)) Then Exit Function 
	Dim ai,StrSqls
	StrSqls =""
	For ai=0 To UBound(catArr,2) 
		If(killint(catArr(0,ai),0,0,5) = killint(beginId,0,0,5) ) Then
			StrSqls = StrSqls & "," &  catArr(2,ai) & ReGetParentsID( killint(catArr(2,ai),0,0,5) )
		End If 
	Next 
	ReGetParentsID = StrSqls
End Function 
'==================================
public Function GetRows(Sqlstr)
	Dim arrs
	on error resume next 
	Set rs	=	conn.execute(Sqlstr)
	if not (rs.eof And rs.bof) Then	
		arrs=rs.getrows()
	End If
	rs.close
	Set rs=Nothing	
	if err then 
		response.write(err.Description)
		err.clear
	End if
	GetRows = arrs 
End Function 
private Function GetOne(sqlstr)

	'Dim makesql
	'makesql ="update "&ConstDBtablearr(1)&" set cat_id = 7 where  cat_id =9" 
	'conn.execute(makesql)

		on error resume next
		Set rs = conn.execute(sqlstr)
		If Err Then
			response.write (err.Description)
			err.Clear
			GetOne = "" 
		else
			if rs.eof and rs.bof then
				GetOne = "" 
			else
				Dim arrs
				arrs =rs.getrows(-1)
				GetOne = arrs(0,0)
			End if
		End if
		Set rs=nothing
End Function 

'检查
Function LevelCheck(mode,urlgo)
	dim referurl':referurl=Request.ServerVariables("HTTP_REFERER")
	'If referurl="" Then referurl="http://www.5do8.com"
	referurl = urlgo
	Dim truelevel
	truelevel = GetUserLevelInt()

	If truelevel =0 Then
		response.redirect(referurl)
		response.End 
	Else
		 If killint(truelevel,0,0,5)- killint(mode,0,0,5)<0 Then'权限太低
			response.redirect(referurl)
			response.End 
		 End If 
	End If 
End Function 

Function GetUserData(mode)
	GetUserData= session(mode)
End Function 
Function CheckCanRead(mode,tempdata,lockyes)
	Dim rbool,sqls,rint
	rbool = true 
	rint = 0 
	if lockyes=true  then 
		select case mode
			case 0:
				sqls = "select [cat_other] from "&ConstDBtablearr(0)&" where [cat_id] = "&killint(tempdata,0,0,5)&""
				rint=GetOne(sqls)
			case 1:
				sqls = "select "&ConstDBtablearr(0)&".[cat_other] from "&ConstDBtablearr(0)&","&ConstDBtablearr(1)&" where ("&ConstDBtablearr(1)&".[info_id] = "&killint(tempdata,0,0,5)&") and ("&ConstDBtablearr(1)&".[cat_id] = "&ConstDBtablearr(0)&".[cat_id]) "
			rint=killint(GetOne(sqls),0,0,5)
		End select
	
		if killint(rint,0,0,5) > GetUserLevelInt() then rbool = false			
	End if 
	CheckCanRead = rbool 
End Function 

Function GetUserLevelInt()
	'const UserLoginID			=	"loginedID"
	'const UserLoginName			=	"logineduser"	'用户参数			
	'const UserLoginPassword		=	"loginedpass"
	'const UserLoginLevel		=	"loginedLevel"
	GetUserLevelInt = LevelToInt(UserConstArr())
End Function 

Function UserConstArr()
	UserConstArr = Array(UserLoginID,UserLoginName,UserLoginPassword,UserLoginLevel)
End Function 

'强行执行用户退出操作
Function UserLogout(arrstr)
	if not isarray(arrstr) then exit Function
	Dim ai
	for ai=0 to ubound(arrstr)
		Session.Contents.Remove(arrstr(ai))
	next
	Response.Cookies(CookiesUserArr).Expires=Date() -1 'cookies 立即结束
End Function 


'
'#######################################################################################
'
'#######################################################################################
'
Public function LevelToInt(arrstr)'0是用户ID，1是用户名，2是密码，3是级别=============>定义的常量
'预先定义2个常量	CookiesUserArr,ConstDBtablearr	，保存的cookies的值
	if not isarray(arrstr) then 
		LevelToInt = 0
		exit Function
	End if 
	if len(session(arrstr(0)))<1 or len(session(arrstr(3)))<1 then '如果session没有保存用户信息
		Dim tempid,tempname,temppassword,templevel
		tempname		=	Request.Cookies(CookiesUserArr)(arrstr(1))
		temppassword	=	Request.Cookies(CookiesUserArr)(arrstr(2))
		if len(tempname)<1 or  len(temppassword)<1 then 
			LevelToInt = 0
		else
			Dim tempuserarr 
			tempuserarr = UserNamePassword(tempname,temppassword)
			if not isarray(tempuserarr) then 
				LevelToInt = 0
			else
				call SaveInsession(arrstr,tempuserarr)
				call SaveInCookies(arrstr,tempuserarr,CookiesExpires)
				LevelToInt = tempuserarr(3,0)
			End if
		End if 
	else
		LevelToInt = killint(session(arrstr(3)),0,0,3)
	End if 
end Function 

'
public Function UserNamePassword(user_name,user_password)'验证成功的时候返回一个2维数组
		if len(user_name)<1 or  len(user_password)<1 then 
			UserNamePassword = ""
		else
			Dim tempid,tempname,temppassword,templevel,tempuserarr,usersql
			usersql = "select top 1 [user_id],[user_name],[user_password],[user_level] from "&ConstDBtablearr(2)&" where ([user_name] ='"&user_name&"') and ([user_password]='"&user_password&"')"
			tempuserarr = GetRows(usersql)
			UserNamePassword = tempuserarr 
		End if 
End Function 
'保存信息在session中
public Function SaveInsession(arrstr,arrsdata)
	if (not isarray(arrstr)) or (not isarray(arrsdata)) then exit Function 
	session(arrstr(0)) = arrsdata(0,0)
	session(arrstr(1)) = arrsdata(1,0)
'	session(arrstr(2)) = arrsdata(2,0)
	session(arrstr(3)) = arrsdata(3,0)
End Function 
'保存信息在Cookies中
public Function SaveInCookies(arrstr,arrsdata,expries)
		if (not isarray(arrstr)) or (not isarray(arrsdata)) then exit Function 
'		Response.Cookies(CookiesUserArr)(arrstr(0))=	arrsdata(0,0)
		Response.Cookies(CookiesUserArr)(arrstr(1)) =	arrsdata(1,0)
		Response.Cookies(CookiesUserArr)(arrstr(2)) =	arrsdata(2,0)
'		Response.Cookies(CookiesUserArr)(arrstr(3)) =	arrsdata(3,0)
		Response.Cookies(CookiesUserArr).Expires=Date() + killint(expries,0,0,5)
End Function 



Public Function LoadTplConfig(baseDirTemp)
	Set Tpl=new Cemplate 
	Tpl.Assign "BasePath",baseDirTemp 
	Tpl.Assign "TopBar",IniMainTitle
	Tpl.Assign "IniTitle",IniTitle
	Tpl.Assign "BaseURI",BaseURI
	Tpl.Assign "NeedHtmlPage",NeedHtmlPage
	Tpl.Assign "SectedID",0 

End Function 

%>